package com.jz.netthings.application.stockManage.controller;


import com.jz.netthings.application.stockManage.bean.ConsumablesType;
import com.jz.netthings.application.stockManage.service.ConsumablesTypeService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 耗材类型信息 前端控制器
 * </p>
 *
 * @author yangyunyun
 * @since 2019-07-19
 */
@RestController
@RequestMapping("/adscm/application/consumablesType")
public class ConsumablesTypeController {

    @Autowired
    ConsumablesTypeService consumablesTypeService;
    /**
     * 新增耗材类型
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/insertType")
    public SimpleCoreResponse insertType(@RequestBody ConsumablesType consumablesType) throws AdscmSystemException {
        consumablesTypeService.insert(consumablesType);
        return new SimpleCoreResponse("200","新增成功",null);
    }
    /**
     * 查询所有耗材类型列表
     * @return
     * @throws AdscmSystemException
     */
    @RequestMapping("/selectAll")
    public SimpleCoreResponse selectAll() throws AdscmSystemException {

        return new SimpleCoreResponse("200","查询成功",consumablesTypeService.selectList(null));
    }

}

